/*
 * Copyright (C), 2002-2018, Caljm有限公司
 * FileName: Application
 * Author:   Byron Wang
 * Date:     2018/11/23 下午11:29
 * Description: //模块目的、功能描述
 * History: //修改记录
 * <author>      <time>      <version>    <desc>
 * 修改人姓名             修改时间            版本号                  描述
 */

package com.cpcs.springboot;

import com.cpcs.springboot.service.UserService;
import com.cpcs.entity.User;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 功能描述：启动类
 *
 * @author Byron Wang
 * @since 2018/11/23
 */
//@RestController
//@SpringBootApplication
// MapperScan 指明Mapper接口扫描包名
//@MapperScan(basePackages = {"com.cpcs.mq.spring.boot.mapper"})
public class MainApplication {

    @GetMapping("/getName.do")
    public String getName() {
        System.out.println("devtools test");
        System.out.println("devtools test");
        return "Byron Wangss";
    }

    @Autowired
    private UserService userService;

    @GetMapping("/allUsers")
    public List<User> getAllUsers() {
        return userService.getAll();
    }

    @Autowired
    private StringRedisTemplate redisTemplate;

    @GetMapping("/getRedisValue.do")
    public String getRedisValue(String key) {
        return redisTemplate.opsForValue().get(key);
    }

    public static void main(String[] args) {
        SpringApplication.run(MainApplication.class, args);
    }
}
